package com.ruoyi.system.Fdongbei.mapper;

import com.ruoyi.system.Fdongbei.domain.TbGuozhong;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author fufeng
 * @since 2024-12-05
 */
public interface TbGuozhongMapper {

    @Select(" select count(*) from tb_guozhong where chehao = #{chehao} and gbzt!='完成' ")
    int tbGuozhongExists(String chehao);


    @Select(" select count(*) from tb_guozhong where ddbh = #{ddbh} and yj != '退车' ")
    int countguozhong(String ddbh);


    @Insert(" insert into tb_guozhong (wlmcc,jsdj,card_id,chehao,czbh,wlbh,wlmc,gblx,gysbh,gysdm,ckbh,ckmc,dbh,gsbh,ddxmbh,gbzt,sjxm,sjdh,sjsfz,yzkz,ddwlsl,ddysdh,ddyszl,nlmtbz1,nlmtbz2,czymc,sapbzsc,yfrq,yfk ,ddbh,ymqysj,guige,ddysmz,ddysjz,fk_zdr,kk_rjbb,yc_ccc,jshth,fksj,chexc)values (" +
            "#{wlmcc} ,#{jsdj} , #{card_id}, #{chehao}, #{czbh}, #{wlbh}, #{wlmc}, #{gblx}, #{gysbh}, #{gysdm}, #{ckbh}, #{ckmc}, #{dbh}, #{gsbh}, #{ddxmbh}, #{gbzt}," +
            " #{sjxm}, #{sjdh}, #{sjsfz}, #{yzkz}, #{ddwlsl}, #{ddysdh}, #{ddyszl}, #{nlmtbz1}, #{nlmtbz2}, #{czymc}, #{sapbzsc}, #{yfrq}, #{yfk}, #{ddbh}, #{ymqysj}, " +
            "#{guige}, #{ddysmz}, #{ddysjz}, #{fkZdr}, #{kkRjbb}   , #{ycCcc} , #{jshth} , #{fksj} , #{chexc}   )")
    int tbGuozhonginsert(TbGuozhong tbGuozhong);


    @Select(" select Max(right(czbh,4)) AS string from tb_guozhong where fksj >= #{stime} and fksj <= #{otime} ")
    public String selectMaxCzbh(@Param("stime") String stime, @Param("otime") String otime);

    @Insert(" insert into tb_guozhong (wlmcc,jsdj,card_id,chehao,czbh,wlbh,wlmc,gblx,gysbh,gysdm,ckbh,ckmc,dbh,gsbh,ddxmbh,gbzt," +
            "sjxm,sjdh,sjsfz,yzkz,ddwlsl,ddysdh,ddyszl,nlmtbz1,nlmtbz2,czymc,sapbzsc,yfrq,yfk ,ddbh,ymqysj," +
            "guige,songdf,sdfbh,shoudf,khbh,jhxm,fk_zdr,sd_dwx,sd_bzwmc,kk_rjbb,yc_ccc,fksj,ht_yccl_yc_kg)values (" +
            "#{wlmcc} ,#{jsdj} , #{card_id}, #{chehao}, #{czbh}, #{wlbh}, #{wlmc}, #{gblx}, #{gysbh}, #{gysdm}, #{ckbh}, #{ckmc}, #{dbh}, #{gsbh}, #{ddxmbh}, #{gbzt}," +
            " #{sjxm}, #{sjdh}, #{sjsfz}, #{yzkz}, #{ddwlsl}, #{ddysdh}, #{ddyszl}, #{nlmtbz1}, #{nlmtbz2}, #{czymc}, #{sapbzsc}, #{yfrq}, #{yfk}, #{ddbh}, #{ymqysj}, " +
            "#{guige}, #{songdf}, #{sdfbh}, #{shoudf}, #{khbh}   , #{jhxm} , #{fkZdr} , #{sdDwx} , #{sdBzwmc} , #{kkRjbb} , #{ycCcc}, #{fksj} , #{htYcclYcKg} )")
    int tbGuozhonginsertsd(TbGuozhong tbGuozhong);


    @Insert("insert into tb_guozhong (wlmcc ,jsdj ,card_id, chehao ,czbh ,wlbh ,gblx ,gbzt, gysdm, fpscsfzh, czymc , guige, gsbh ,zjshbs,jshth ,ymqysj,zczm,wlmc,bz,fk_zdr,kk_rjbb,yc_ccc,fksj)values(" +
            "#{wlmcc},#{jsdj},#{card_id},#{chehao},#{czbh},#{wlbh},#{gblx},#{gbzt},#{gysdm},#{fpscsfzh},#{czymc},#{guige},#{gsbh},#{zjshbs},#{jshth},#{ymqysj},#{zczm},#{wlmc},#{bz},#{fkZdr},#{kkRjbb},#{ycCcc},#{fksj})")
    int tbGuozhonginsertsh(TbGuozhong tbGuozhong);


    @Insert(" insert into tb_guozhong (chehao,card_id ,czbh,wlmc,gysdm,gsmc,ckbh,ckmc,ddysdh,ddyszl,guige,yslx,wlmcc,gblx,czymc,gbzt,ymqysj,ddwlsl,wlbh,fk_zdr,sd_dwx,ddbh,sd_bzwmc,kk_rjbb,yc_ccc,zzmtbs,songdf, fksj)values (" +
            "#{chehao},#{card_id},#{czbh},#{wlmc},#{gysdm},#{gsmc},#{ckbh},#{ckmc},#{ddysdh},#{ddyszl},#{guige},#{yslx},#{wlmcc},#{gblx},#{czymc},#{gbzt},#{ymqysj},#{ddwlsl},#{wlbh},#{fkZdr},#{sdDwx},#{ddbh},#{sdBzwmc},#{kkRjbb},#{ycCcc},#{zzmtbs},#{songdf},#{fksj})")
    int tbGuozhonginsertzz(TbGuozhong tbGuozhong);


    @Select(" select \n" +
            "gid,\n" +
            "ddbh,\n" +
            "czbh,\n" +
            "card_id,\n" +
            "chehao,\n" +
            "wlmc,\n" +
            "mzsj,\n" +
            "dbh,\n" +
            "pzsj,\n" +
            "dbh2,\n" +
            "gbzt,\n" +
            "yj,\n" +
            "sd_dwx,\n" +
            "sd_bzwmc,\n" +
            "fksj\n" +
            "from tb_guozhong " +
            " where czbh like CONCAT('%',#{sql},'%') or chehao like  CONCAT('%',#{sql},'%') ; ")
    List<TbGuozhong> selectyccl(@Param("sql") String sql);


    @Select(" SELECT\n" +
            // "\t gid, \n" +
            "\tczbh, \n" +
            "\tddbh, \n" +
            "\tcard_id, \n" +
            "\tchehao, \n" +
            "\twlmcc, \n" +
            "\tgysbh, \n" +
            "\tgysdm, \n" +
            "\tgsmc, \n" +
            "\tgsbh, \n" +
            "\twlbh, \n" +
            "\twlmc, \n" +
            "\tckbh, \n" +
            "\tckmc, \n" +
            "\tkhbh, \n" +
            "\tsongdf, \n" +
            "\tsdfbh, \n" +
            "\tshoudf, \n" +
            "\tjhxm, \n" +
            "\tmz, \n" +
            "\tmzsj, \n" +
            "\tpz, \n" +
            "\tpzsj, \n" +
            "\tjz, \n" +
            "\thykz, \n" +
            "\thyjfkx, \n" +
            "\tyzkz, \n" +
            "\tjszl, \n" +
            "\tyzzl, \n" +
            "\tjsdj, \n" +
            "\tjsje, \n" +
            "\tjlscbz, \n" +
            "\tyhckrxm, \n" +
            "\tyhkh, \n" +
            "\tlxdh, \n" +
            "\tfpbh, \n" +
            "\tfpshr, \n" +
            "\tfpscxxlrsj, \n" +
            "\tfpscsfzh, \n" +
            "\tfpsccgbz, \n" +
            "\tgblx, \n" +
            "\tgbzt, \n" +
            "\thytb, \n" +
            "\tsgtm, \n" +
            "\tsby, \n" +
            "\txhry, \n" +
            "\tyj, \n" +
            "\ttplj, \n" +
            "\tddxmbh, \n" +
            "\tzczm, \n" +
            "\tzczmtp, \n" +
            "\tshsfzh, \n" +
            "\tddlx, \n" +
            "\tzcks, \n" +
            "\tzcmz, \n" +
            "\tsjxm, \n" +
            "\tsjdh, \n" +
            "\tsjsfz, \n" +
            "\tymqybsm, \n" +
            "\tymqysj, \n" +
            "\tymsbm, \n" +
            "\tymsbmdy, \n" +
            "\txcp, \n" +
            "\txcpdy, \n" +
            "\tzcp, \n" +
            "\tzcpdy, \n" +
            "\thyd, \n" +
            "\thyddy, \n" +
            "\tcmz, \n" +
            "\tcmzdy, \n" +
            "\txcbm, \n" +
            "\tzjshbs, \n" +
            "\tshfpbh, \n" +
            "\tshfpbhdy, \n" +
            "\tddwlsl, \n" +
            "\trkgbd, \n" +
            "\trkgbddy, \n" +
            "\tckgbd, \n" +
            "\tckgbddy, \n" +
            "\tddysdh, \n" +
            "\tddyszl, \n" +
            "\tdbh, \n" +
            "\tdbh2, \n" +
            "\tczymc, \n" +
            "\tczymc2, \n" +
            "\tnlmtbz1, \n" +
            "\tnlmtbz2, \n" +
            "\tqyry, \n" +
            "\tjlscsbcs, \n" +
            "\tjshth, \n" +
            "\tfpscsbcs, \n" +
            "\tfpscfhwb, \n" +
            "\torclgl, \n" +
            "\thysqgch, \n" +
            "\tddbdcs, \n" +
            "\tguige, \n" +
            "\tsapbzsc, \n" +
            "\tfzfs, \n" +
            "\tzds, \n" +
            "\tzzysdw, \n" +
            "\tyfrq, \n" +
            "\tyfk, \n" +
            "\tbzxx, \n" +
            "\tdzymkz, \n" +
            "\tyslx, \n" +
            "\tcckz, \n" +
            "\tdzymkdz, \n" +
            "\tershisibz, \n" +
            "\tyc_jzcc, \n" +
            "\tyc_ccc, \n" +
            "\tjctu_cp, \n" +
            "\tjctu_hk, \n" +
            "\tcctu_cp, \n" +
            "\tcctu_hk, \n" +
            "\tbz, \n" +
            "\tczqztc, \n" +
            "\tlscp, \n" +
            "\tlscp_bj, \n" +
            "\tddysmz, \n" +
            "\tddysjz, \n" +
            "\tysjz_bj, \n" +
            "\tfk_zdr, \n" +
            "\tsd_dwx, \n" +
            "\tsd_bzwmc, \n" +
            "\tfw_zdz, \n" +
            "\tfw_zgz, \n" +
            "\tfw_nwx, \n" +
            "\tfw_bzwm, \n" +
            "\tkk_rjbb, \n" +
            "\tgb_rjbb, \n" +
            "\tfksj, \n" +
            "\tcl_fbbz, \n" +
            "\tht_yccl_yc_kg, \n" +
            "\tzzmtbs, \n" +
            "\tphoto_sfz, \n" +
            "\tyhzhsfzh, \n" +
            "\tfpph, \n" +
            "\thzddybs, \n" +
            "\tchexc, \n" +
            "\tzhuanchangbiaoji, \n" +
            "\tzhuanchangcishu, \n" +
            "\tphoto_ckqr, \n" +
            "\tphoto_zxcqr, \n" +
            "\tqymc, \n" +
            "\tkhyh, \n" +
            "\tyshdwmc, \n" +
            "\tzzjgdm, \n" +
            "\tsllx, \n" +
            "\tphoto_wtxy, \n" +
            "\tphoto_zczm, \n" +
            "\tphoto_cbtdht, \n" +
            "\tphoto_zt\n" +
            "FROM tb_guozhong where czbh = #{czbh} ")
    TbGuozhong selectByCzbh(String czbh);


    @Delete(" delete from tb_guozhong where czbh = #{czbh} ")
    int deleteguozhongbyczbh(String czbh);


    @Update(" update tb_guozhong set gbzt = #{gbzt} where czbh = #{czbh} ")
    int updategbztbyczbh(@Param("gbzt") String gbzt, @Param("czbh") String czbh);


    @Update(" update tb_guozhong set yj = #{yj} where czbh = #{czbh} ")
    int updateyjbyczbh(@Param("gbzt") String yj, @Param("czbh") String czbh);


    @Select(" select * from tb_guozhong where ymqybsm = #{ymqybsm}  ")
    TbGuozhong selectByYmqybsm(String ymqybsm);

    @Update(" update tb_guozhong set hykz = #{hykz} where ymqybsm = #{ymqybsm} ")
    int updatehykz(@Param("hykz") String hykz, @Param("ymqybsm") String ymqybsm);

    @Update(" update tb_guozhong set jsdj=#{jsdj},orclgl=#{orclgl}  where ymqybsm=#{ymqybsm} ")
    int updatejsdj(@Param("jsdj") String jsdj,@Param("orclgl") String orclgl, @Param("ymqybsm") String ymqybsm);



}
